package com.sen.pro.switches.core.serivce.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.sen.common.orm.PublicDao;
import com.sen.pro.switches.core.entity.News;
import com.sen.pro.switches.core.serivce.NewsService;

/**
 * 新闻管理接口实现类
 * 
 * @author tian qingsen
 */
@Service("newsService")
public class NewsServiceImpl implements NewsService {

	@Resource(name = "publicDao")
	private PublicDao publicDao;

	@Override
	public List<News> queryAllNews() {
		return publicDao.query("queryAllNews");
	}

	@Override
	public News getNewsById(Integer id) {
		return publicDao.querySingle("getNewsById", id);
	}

	@Override
	public Integer insertNews(News news) throws Exception {
		return (Integer) publicDao.insert("insertNews", news);
	}

	@Override
	public int updateNews(News news) {
		return publicDao.update("updateNews", news);
	}

	@Override
	public int deleteNews(Integer id) throws Exception {
		return publicDao.delete("deleteNews", id);
	}
}
